# -*- coding:utf-8 -*-

from pymongo import MongoClient

class MongodbTool(object):



    # 初始化
    def __init__(self, host='', port=''):

        if host == "":
            host = 'localhost'

        if port == '':
            port = 27017
        self.client = MongoClient(host, port)
        self.database = ''

    # 获取客户端实体
    def get_client(self):
        return self.client

    # 获取数据库
    def get_database(self, data_base=''):
        if data_base == '':
            data_base = 'douyin'
        self.database = self.client[data_base]
        return self.database






